<template>
  <div class="dy-main">
    <div class="dy-header">
      <x-header :right-options="{showMore: true}" :left-options="{preventGoBack:true}" @on-click-back="back" @on-click-more="showMenus = true">标题</x-header>
    </div>
    <div class="dy-body">
      <div class="dy-wapper">
        <scroller lock-x>
          <div class="scroller-box">
            <group label-width="1.9rem" title="时间快捷设置">
              对应时间：{{ aRes }}
              {{ bRes }}
              <x-button type="primary" @click.native="timeFormat">格式化</x-button>
              <x-button type="primary" @click.native="settime(-7)">一周前</x-button>
              <x-button type="primary" @click.native="settimeMonth(1)">一个月前</x-button>
              <x-button type="primary" @click.native="settimeMonth(3)">三个月前</x-button>
              <x-button type="primary" @click.native="settimeMonth(6)">六个月前</x-button>
            </group>
          </div>
        </scroller>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  mounted () {
  },
  methods: {
    back () {
      this.$publicFun.goBack(this)
    },
    timeFormat () {
      this.bRes = this.$publicFun.timeFormat('yyyy-MM-dd', new Date('2018-08-03'))
    },
    settime (val) {
      let nowDate = this.$publicFun.timeFormat('yyyy-MM-dd', new Date())
      this.aRes = this.$publicFun.timeHandle(nowDate, val)
    },
    settimeMonth (val) {
      let nowDate = this.$publicFun.timeFormat('yyyy-MM-dd', new Date())
      // nowDate = new Date('2018-05-31')
      this.aRes = this.$publicFun.setFastTime(nowDate, val)
    }
  },
  data () {
    return {
      aRes: '',
      bRes: ''
    }
  },
  watch: { }
}
</script>
<style>
</style>
